package com.dragon.mmochat.model.object;

import com.dragon.mmochat.MmochatConstant;
import com.dragon.mmochat.model.battle.MmochatBattle;
import com.dragon.mmochat.model.enumType.MmochatMaterialType;
import com.dragon.mmochat.model.enumType.MmochatObjectType;
import com.dragon.mmochat.util.MmochatUtil;
import com.google.gson.reflect.TypeToken;

//材料,可叠加
public class MmochatMaterial extends MmochatCommonObject implements Cloneable {
	private static final long serialVersionUID = 3649022988191649692L;

	public MmochatMaterial() {
		super();
		objectType = MmochatObjectType.材料;
		canOverlap = true;
	}

	public MmochatMaterial getClone() {
		return (MmochatMaterial) MmochatUtil.deepClone(this,
				new TypeToken<MmochatMaterial>() {
				}.getType());
	}

	public MmochatMaterialType getType() {
		return materialType;
	}

	public void setType(MmochatMaterialType type) {
		this.materialType = type;
	}

	public int getNum() {
		return overlapNum;
	}

	public void setNum(int num) {
		this.overlapNum = num;
	}

	public void addNum(int add) {
		overlapNum += add;
		overlapNum = Math.min(overlapNum,
				MmochatConstant.maxNumToOverlapOfPackage);
		overlapNum = Math.max(overlapNum, 0);
	}

}
